<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of m_dmktlkl
 *
 * @author Trung Đặng
 */
class M_odulieu extends CI_Model {

    public function __construct() {
        parent::__construct();
      
    }

    public function getAll($FK_Ma_BieuMau) {
        // $this->db->where('FK_Ma_BieuMau',$FK_Ma_BieuMau);
        $query = $this->db->get('tbl_odulieu');
        $dsodulieu = FALSE;
        foreach ($query->result_array() as $row) {

            $dsodulieu[] = $row;
        }
        return $dsodulieu;
    }

    public function them($ViTriO, $Nhan, $FK_Ma_BieuMau, $type,$F) {
        $ViTriO=strtoupper($ViTriO);
        $this->db->set('ViTriO', $ViTriO);
        $this->db->set('Nhan', $Nhan);
        $this->db->set('FK_Ma_BieuMau', $FK_Ma_BieuMau);
        $this->db->set('type', $type);
        $this->db->set('F', $F);
        return $this->db->insert('tbl_odulieu');
    }
    function capnhat($id,$Nhan,$ViTriO,$type){
         $ViTriO=strtoupper($ViTriO);
        $this->db->where('id',$id);
        $this->db->set('ViTriO', $ViTriO);
        $this->db->set('Nhan', $Nhan);        
        $this->db->set('type', $type);
        return $this->db->update('tbl_odulieu');
    }
    function xoa($id){
        $this->db->Where('id',$id);
        $this->db->delete('tbl_odulieu');
    }
    function xoaAll($FK_Ma_BieuMau){
        $this->db->where('FK_Ma_BieuMau',$FK_Ma_BieuMau);
        $this->db->delete('tbl_odulieu');
    }

   

}
